//
//  LXAppInfo.m
//  九宫格
//
//  Created by 互联网 on 16/7/14.
//  Copyright © 2016年 aa. All rights reserved.
//

#import "LXAppInfo.h"

@implementation LXAppInfo

-(instancetype)initWithDict:(NSDictionary *)dict
{
//   [self setValuesForKeysWithDictionary:dict];
    self=[super init];
    if (self) {
        self.icon=dict[@"icon"];
        self.name=dict[@"name"];
    }
   return self;
}

+(instancetype)infoWithDict:(NSDictionary *)dict
{
    return [[self alloc]initWithDict:dict];
}


+(NSArray *)appInfoList{
    //1.1 bundle
    NSBundle *bundle=[NSBundle mainBundle];
    //1.2 取出plist'数据
    NSString *path=[bundle pathForResource:@"app" ofType:@"plist"];
    //
    NSArray *array=[NSMutableArray arrayWithContentsOfFile:path];
    //字典转模型
    NSMutableArray *tempArray=[NSMutableArray array];
    for(NSDictionary *dict in array)
    {
        
        LXAppInfo *appInfo=[self infoWithDict:dict];
        [tempArray addObject:appInfo];
        
    }
    return tempArray;
}
@end
